<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<SystemUser>" %>
<%@ Import Namespace="TeamCommunitySolution.Domain.DataLayer.Base"%>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Profile
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <script type="text/javascript">
        $(document).ready(function() {
            $("#invitesForm").dialog({
                bgiframe: true,
                autoOpen: false,
                height: 200,
                width: 400,
                zIndex: 400,
                modal: true,
                buttons: {
                    'Done': function() {
                        $(this).dialog('close');
                    }
                }
            });

            $("#viewInvite").click(function() {
                $("#invitesForm").dialog('open');
                return false;
            });

        });
        $(function() {
            $("#accordion").accordion();
        });
    </script>

    <h2>
        Profile</h2>
    <%= Html.ValidationSummary("Edit was unsuccessful. Please correct the errors and try again.") %>
    <% using (Html.BeginForm())
       {%>
    <%= Html.Hidden("Id", Model.Id) %>
    <!-- Left Float -->
    <div style="float: left; width: 35%;">
        <div id="accordion">
            <h3>
                <a href="#">Inbox</a>
            </h3>
            <div class="teamset">
                <div class="toolbar">
                  <%= Html.ActionLink("__IMAGE_PLACEHOLDER__", "CreatePersonalMessage", "CommunicationCenter", null, null).Replace("__IMAGE_PLACEHOLDER__", "<img src=\"/Content/Interface/createmail.png\" width=\"24\" border=\"0\" />")%>
                </div>
                <%
                    Html.RenderPartial("~/Views/CommunicationCenter/InboxView.ascx", Model.PrivateMessageInbox); %>
            </div>
            <h3>
                <a href="#">Outbox</a>
            </h3>
            <div class="teamset">
                <%
                    Html.RenderPartial("~/Views/CommunicationCenter/OutboxView.ascx", Model.PrivateMessageOutbox); %>
            </div>
            <h3>
                <a href="#">Teams [Created]</a>
            </h3>
            <div class="teamset">
                <p>
                    <%= Html.ActionLink("Create New Team", "Create", "Team", null, new { @class = "hrefbutton" })%>
                    | Outgoing Requests:
                    <%= Html.Encode(Model.TeamRequestSentList.Count) %></p>
                <%
                    Html.RenderPartial("~/Views/Team/TeamList.ascx", Model.TeamCreatedList.ToList()); %>
            </div>
            <h3>
                <a href="#">Teams [Member Of]</a>
            </h3>
            <div class="teamset">
                Incoming Requests:
                <%= Html.Encode(Model.TeamRequestReceivedList.Count) %>&nbsp;
                <% if (Model.TeamRequestReceivedList.Count > 0)
                   { %>
                <button id="viewInvite" class="ui-button ui-state-default ui-corner-all">
                    View Invites</button>
                <div id="invitesForm" style="overflow: scroll">
                    <% Html.RenderPartial("~/Views/Team/InviteAcceptForm.ascx", Model); %>
                </div>
                <%} %>
                <%
                    Html.RenderPartial("~/Views/Team/MemberTeamList.ascx", Model.MemberOfTeamList.ToList()); %>
            </div>
            <h3>
                <a href="#">Venues [Created]</a>
            </h3>
            <div class="teamset">
                <%= Html.ActionLink("Create New Venue", "Create", "Venue", null, new { @class = "hrefbutton" })%>
                <br /><br />
                <%
                    Html.RenderPartial("~/Views/Venue/VenueList.ascx", Model.OwnerVenueList.ToList()); %>
            </div>
            <h3>
                <a href="#">Leagues [Created]</a>
            </h3>
            <div class="teamset">
                <%= Html.ActionLink("Create New League", "LeagueCreate", "League", null, new { @class = "hrefbutton" })%>
                <br /><br />
                <%
                    Html.RenderPartial("~/Views/League/LeagueList.ascx", Model.OwnerLeagueList.ToList()); %>
            </div>
        </div>
    </div>
    <!-- Right Float -->
    <div style="float: right; width: 60%;">
        <div style="float: left; width: 50%; padding-right: 5px;">
            <fieldset>
                <legend>Fields</legend>
                <p>
                    <label for="Email">
                        Email:</label>
                    <%= Html.TextBox("Email", Model.Email) %>
                    <%= Html.ValidationMessage("Email", "*") %>
                </p>
                <p>
                    <label for="FirstName">
                        First Name:</label>
                    <%= Html.TextBox("FirstName", Model.FirstName) %>
                    <%= Html.ValidationMessage("FirstName", "*") %>
                </p>
                <p>
                    <label for="LastName">
                        Last Name:</label>
                    <%= Html.TextBox("LastName", Model.LastName) %>
                    <%= Html.ValidationMessage("LastName", "*") %>
                </p>
                <p>
                    <label for="NickName">
                        NickName:</label>
                    <%= Html.TextBox("NickName", Model.NickName) %>
                    <%= Html.ValidationMessage("NickName", "*") %>
                </p>
                <p>
                    <label for="birthDate">
                        Date of birth (yyyy/mm/dd):</label>
                    <%= Html.TextBox("dateOfBirth", Model.DateOfBirth.ToShortDateString())%>
                    <%= Html.ValidationMessage("dateOfBirth","*") %>
                </p>
                <p>
                    <input type="submit" value="Save" />
                </p>
            </fieldset>
        </div>
    </div>
    <% } %>
</asp:Content>
